<script >
import HelloVue from './components/Hello.vue'
import ContentVue from './components/Content.vue'
import ChildCpt from './components/ChildCpt.vue'
import { ref, provide } from 'vue';
export default {
  components: {
    HelloVue,
    ContentVue,
    ChildCpt
  },
  methods: {
    injectdata: function (value) {
      console.log(value);
    }
  },
  mounted() {
    // console.log(this.$refs.content);
    // this.$refs.content.sendParent()
  },
  setup() {
    // const schoolName = ref('Hello GUET!')
    // return { schoolName }
    const name = ref('GUET！')//使用provide和inject来实现跨级通讯
    provide('school', name)
    function changeSchool() {
      name.value = '桂林电子科技大学'
    }
    return { changeSchool }
  },
}
</script>

<template>
  <div>
    <!-- <HelloVue></HelloVue> -->
    <!-- <ContentVue :schoolName='schoolName' :style="{color:'skyblue'}" @injectdata="injectdata" ref="content"></ContentVue> -->
    <!-- <button @click="schoolName = '广西小清华'">改变名称</button> -->
    <ChildCpt></ChildCpt>
    <button @click="changeSchool">学校全称</button>
  </div>
</template>

<style scoped>
header {
  line-height: 1.5;
}

.logo {
  display: block;
  margin: 0 auto 2rem;
}

@media (min-width: 1024px) {
  header {
    display: flex;
    place-items: center;
    padding-right: calc(var(--section-gap) / 2);
  }

  .logo {
    margin: 0 2rem 0 0;
  }

  header .wrapper {
    display: flex;
    place-items: flex-start;
    flex-wrap: wrap;
  }
}
</style>
